package com.dxy.data.webcloud.up2u.domain;

import com.dxy.data.webcloud.up2u.Service.RoleService;
import com.dxy.data.webcloud.up2u.config.ApplicationContextRegister;
import lombok.Data;

/**
 * Created by yinxing on 2018/9/12.
 */

/**
 * 统一管理平台用户列表信息
 * @author weixin
 */
@Data
public class OpenApiUserInfo {

    private String email;

    private String username;

    private String groupName;

    private String roleName;

    private String source="medicalbrain";

    private Integer sourceId;

    public OpenApiUserInfo() {
    }

    public OpenApiUserInfo(UserDO userInfo) {
        RoleService roleService = ApplicationContextRegister.getBean(RoleService.class);
        this.email = userInfo.getEmail();
        this.username = userInfo.getUsername();
        this.groupName = userInfo.getDeptName();
        this.sourceId = userInfo.getId();
        RoleDO roleDO = roleService.list(userInfo.getId()).get(0);
        this.roleName = roleDO.getRoleName();
    }

}
